<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:a="http://richfaces.org/a4j"
                template="template.xhtml">

    <ui:define name="content">

        <div class="section">
            <h2>#{messages['task_list_header']}</h2>
            <a:outputPanel ajaxRendered="true">
                <div class="messages"><h:messages id="messages" infoClass="successBox"
                                                  warnClass="infoBox" errorClass="warningBox" fatalClass="errorBox"
                                                  globalOnly="true" showDetail="false" showSummary="true" />
                </div>
            </a:outputPanel>
            <h:form>
                <script type="text/javascript">
                //<![CDATA[
                function disableOnClick(lockingObject) {
                    lockingObject.onclick = function()  {
                        return false;
                    }
                }
                //]]>
                </script>
                <a:outputPanel id="infoPanel" rendered="#{myTasksQuery.size()==0}">
                    <p>
                        <span class="infoBox">
                            <h:outputText value="#{messages['no_task_list_message']}"/>
                        </span>
                    </p>
                </a:outputPanel>		

                <a:outputPanel id="task_list">				
                    <h:dataTable id="data1" var="task" rendered="#{myTasksQuery.size() > 0}"
                                 value="#{myTasksQuery}" 
                                 styleClass="bodyTable">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{messages['task_name_label']}" />
                            </f:facet>
                            <h:outputText value="#{task.getTask().getName()}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{messages['task_oldPasswd']}" />
                            </f:facet>
                            <h:outputText value="#{task.variables['oldPasswd']}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{messages['task_newPasswd']}" />
                            </f:facet>
                            <h:outputText value="#{task.variables['newPasswd']}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{messages['task_newPasswdRepeat']}" />
                            </f:facet>
                            <h:outputText value="#{task.variables['newPasswdRepeat']}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{messages['task_action_label']}" />
                            </f:facet>
                            <a:commandLink action="#{taskListPage.changePassword(task)}" reRender="task_list"  
                                           status="gstat">
                                <h:outputText value="#{messages['task_send_activation_mail_label']}" />
                            </a:commandLink>
                            <br/>					
                        </h:column>
                    </h:dataTable>
                </a:outputPanel>

            </h:form>
        </div>

    </ui:define>
</ui:composition>